#ifndef TWO_PLAYER_H
#define TWO_PLAYER_H

#include <QWidget>
const int Block_Size_dou=25;//方块大小
const int Row_dou=20;//行数
const int Col_dou=12;//列数
const int Area_Out_dou=25;//计分板等边距

enum Direction_duo{
    UP_duo,
    DOWN_duo,
    LEFT_duo,
    RIGHT_duo,
    SPACE_duo
};
//方向操控器件

struct Border_duo{
    int up_bound;
    int down_bound;
    int left_bound;
    int right_bound;
};
//边界信息

struct Block_Point_duo{
    int x_pos;
    int y_pos;
};
//坐标信息
namespace Ui {
class Two_Player;
}

class Two_Player : public QWidget
{
    Q_OBJECT

public:
    explicit Two_Player(QWidget *parent = nullptr);
    ~Two_Player();
    void Init_Game_dou();//初始化
    void Start_Game_dou();//开始
    void Game_Over_dou();
    void Block_Reset();
    void Block_Move(Direction_duo dir);
    void Block_Revolve(int Block_use[4][4]);
    void Block_Crate(int Block_use[4][4], int Block_ID);
    void Border_Side(int Block_use[4][4],Border_duo &border);
    void Block_Stable(int x, int y);
    bool If_Crash(int x, int y, Direction_duo);
    bool isOver_dou();
public:
    void closeEvent(QCloseEvent *event) override;
signals:
    void close_dou();
private:
    Ui::Two_Player *ui;
private:
    bool is_Over_dou=false;
    int Game_Area_dou[Row_dou][Col_dou];
    int Game_Timer_dou;
    int Paint_Timer_dou;
    int Down_Time_dou;
    int Refresh_Time_dou;
    int score_dou;
};

#endif // TWO_PLAYER_H
